<%--
  Created by IntelliJ IDEA.
  User: Albert Lee
  Date: 2020/5/26
  Time: 16:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
    <title>新建用户信息</title>

    <script type="text/javascript">
        function validate(){
            var id = document.forms[0].userid.value;
            var name = document.forms[0].username.value;// 0为id号。
            var pwd = document.forms[0].userpassword.value;
            var marks = document.forms[0].usermarks.value;

            if(id.length <= 0){
                alert("id不能为空，请输入id！");
                return false;
            } else if(name.length <= 0){
                 alert("昵称不能为空，请输入昵称！");
                 return false;
            } else if(pwd.length  <= 0){
                 alert("请输入合法密码！");
                 return false;
            }else if(marks.length  <= 0){
                alert("请写点个人签名吧！");
                return false;
            }
        }
     </script>
    </head>
    <link rel="stylesheet" href="css/header.css">

<body background="resourse/bg.jpg">

<div id="header"><!--页头-->
    <spana >&emsp;巴以小记</spana>
    <br>
    <spanb >&emsp;&emsp;注册</spanb>
    <ul>
        <li><h2 class="comment"><a class="btna" href="index.html" >登录</a></h2></li>
    </ul>
</div>
<%
    long time = System.currentTimeMillis() / 1000;
    int days=((int)time)/(3600*24);
    int hours=((int)time)%(3600*24)/3600;
    int minutes = ((int)time)%(3600*24)%3600/60;
    int seconds = ((int)time)%(3600*24)%3600%60%60;

    int uid= days  + hours  + minutes  + seconds;
    String userid = String.valueOf(uid);
%>

<br>
<div style="width: 100%;height: 100% ">
    <spana style="font-size:40px; margin-left: 45%;">有心事</spana>
    <br>
    <spana style="font-size:40px; margin-left: 43%;">写易博小记</spana>
    <div  style="width: 400px;height: 300px; box-shadow: 10px 10px 10px 0px rgba(0,0,0,0.5); background-color:rgba(128,191,92,0.7);margin-left: 35%;margin-top: 1% ;position: relative;border-radius: 10px">
        <h1 style=" color: green;margin-left: 35%;margin-top: 5%">注册新用户</h1>
        <div style="margin-left: 18%">
            <form action="userinsert.jsp" method="post" id="form" onSubmit="return validate()" >
                <p><b style="color:green;">ID&emsp;号&ensp;</b><input type="text" name="userid" value="<%=userid%>" readonly style="width: 200px;height: 25px;border: 1px solid black;"></input><br></p>
                <p><b style="color:green;">昵&emsp;称&ensp;</b><input type="text" name="username"  style="width: 200px;height: 25px;border: 1px solid black;"></input><br></p>
                <p><b style="color:green;">密&emsp;码&ensp;</b><input type="text" name="userpassword" style="width: 200px;height: 25px;border: 1px solid black"></input><br></p>
                <p><b style="color:green;">签&emsp;名&ensp;</b><input type="text" name="usermarks" style="width: 200px;height: 25px;border: 1px solid black"></input><br></p>
                <p><input id="submit" type="submit" value="注册"  style="height: 25px;width: 60px;margin: 20px 40px 20px 40px;border-radius: 5px;border: 1px solid black">
                    <input id="login" type="button" value="登录"  onclick=" window.location.href='index.html';" style="height: 25px;width: 60px;margin: 20px 10px 20px 10px;border-radius: 5px;border: 1px solid black">
                </p>
            </form>
        </div>
    </div>
</div>

</body>
</html>
